/***************************************************************************
 *
 * Copyright 2015-2019 BES.
 * All rights reserved. All unpublished rights reserved.
 *
 * No part of this work may be used or reproduced in any form or by any
 * means, or stored in a database or retrieval system, without prior written
 * permission of BES.
 *
 * Use of this work is governed by a license granted by BES.
 * This work contains confidential and proprietary information of
 * BES. which is protected by copyright, trade secret,
 * trademark and other intellectual property rights.
 *
 ****************************************************************************/
#ifndef __HAL_IOMUX_BEST2000_H__
#define __HAL_IOMUX_BEST2000_H__

#ifdef __cplusplus
extern "C" {
#endif

#include "plat_types.h"

#ifndef ROM_BUILD
#define PMU_HAS_LED_PIN
#endif

enum HAL_IOMUX_PIN_T {
    HAL_IOMUX_PIN_P0_0 = 0,
    HAL_IOMUX_PIN_P0_1,
    HAL_IOMUX_PIN_P0_2,
    HAL_IOMUX_PIN_P0_3,
    HAL_IOMUX_PIN_P0_4,
    HAL_IOMUX_PIN_P0_5,
    HAL_IOMUX_PIN_P0_6,
    HAL_IOMUX_PIN_P0_7,

    HAL_IOMUX_PIN_P1_0,
    HAL_IOMUX_PIN_P1_1,
    HAL_IOMUX_PIN_P1_2,
    HAL_IOMUX_PIN_P1_3,
    HAL_IOMUX_PIN_P1_4,
    HAL_IOMUX_PIN_P1_5,
    HAL_IOMUX_PIN_P1_6,
    HAL_IOMUX_PIN_P1_7,

    HAL_IOMUX_PIN_P2_0,
    HAL_IOMUX_PIN_P2_1,
    HAL_IOMUX_PIN_P2_2,
    HAL_IOMUX_PIN_P2_3,
    HAL_IOMUX_PIN_P2_4,
    HAL_IOMUX_PIN_P2_5,
    HAL_IOMUX_PIN_P2_6,
    HAL_IOMUX_PIN_P2_7,

    HAL_IOMUX_PIN_P3_0,
    HAL_IOMUX_PIN_P3_1,
    HAL_IOMUX_PIN_P3_2,
    HAL_IOMUX_PIN_P3_3,
    HAL_IOMUX_PIN_P3_4,
    HAL_IOMUX_PIN_P3_5,
    HAL_IOMUX_PIN_P3_6,
    HAL_IOMUX_PIN_P3_7,

    HAL_IOMUX_PIN_P4_0,
    HAL_IOMUX_PIN_P4_1,
    HAL_IOMUX_PIN_P4_2,
    HAL_IOMUX_PIN_P4_3,
    HAL_IOMUX_PIN_P4_4,
    HAL_IOMUX_PIN_P4_5,
    HAL_IOMUX_PIN_P4_6,
    HAL_IOMUX_PIN_P4_7,

    HAL_IOMUX_PIN_NUM,

    HAL_IOMUX_PIN_LED1 = HAL_IOMUX_PIN_NUM,
    HAL_IOMUX_PIN_LED2,

    HAL_IOMUX_PIN_LED_NUM,
};

enum HAL_GPIO_PIN_T {
    HAL_GPIO_PIN_P0_0 = HAL_IOMUX_PIN_P0_0,
    HAL_GPIO_PIN_P0_1 = HAL_IOMUX_PIN_P0_1,
    HAL_GPIO_PIN_P0_2 = HAL_IOMUX_PIN_P0_2,
    HAL_GPIO_PIN_P0_3 = HAL_IOMUX_PIN_P0_3,
    HAL_GPIO_PIN_P0_4 = HAL_IOMUX_PIN_P0_4,
    HAL_GPIO_PIN_P0_5 = HAL_IOMUX_PIN_P0_5,
    HAL_GPIO_PIN_P0_6 = HAL_IOMUX_PIN_P0_6,
    HAL_GPIO_PIN_P0_7 = HAL_IOMUX_PIN_P0_7,

    HAL_GPIO_PIN_P1_0 = HAL_IOMUX_PIN_P1_0,
    HAL_GPIO_PIN_P1_1 = HAL_IOMUX_PIN_P1_1,
    HAL_GPIO_PIN_P1_2 = HAL_IOMUX_PIN_P1_2,
    HAL_GPIO_PIN_P1_3 = HAL_IOMUX_PIN_P1_3,
    HAL_GPIO_PIN_P1_4 = HAL_IOMUX_PIN_P1_4,
    HAL_GPIO_PIN_P1_5 = HAL_IOMUX_PIN_P1_5,
    HAL_GPIO_PIN_P1_6 = HAL_IOMUX_PIN_P1_6,
    HAL_GPIO_PIN_P1_7 = HAL_IOMUX_PIN_P1_7,

    HAL_GPIO_PIN_P2_0 = HAL_IOMUX_PIN_P2_0,
    HAL_GPIO_PIN_P2_1 = HAL_IOMUX_PIN_P2_1,
    HAL_GPIO_PIN_P2_2 = HAL_IOMUX_PIN_P2_2,
    HAL_GPIO_PIN_P2_3 = HAL_IOMUX_PIN_P2_3,
    HAL_GPIO_PIN_P2_4 = HAL_IOMUX_PIN_P2_4,
    HAL_GPIO_PIN_P2_5 = HAL_IOMUX_PIN_P2_5,
    HAL_GPIO_PIN_P2_6 = HAL_IOMUX_PIN_P2_6,
    HAL_GPIO_PIN_P2_7 = HAL_IOMUX_PIN_P2_7,

    HAL_GPIO_PIN_P3_0 = HAL_IOMUX_PIN_P3_0,
    HAL_GPIO_PIN_P3_1 = HAL_IOMUX_PIN_P3_1,
    HAL_GPIO_PIN_P3_2 = HAL_IOMUX_PIN_P3_2,
    HAL_GPIO_PIN_P3_3 = HAL_IOMUX_PIN_P3_3,
    HAL_GPIO_PIN_P3_4 = HAL_IOMUX_PIN_P3_4,
    HAL_GPIO_PIN_P3_5 = HAL_IOMUX_PIN_P3_5,
    HAL_GPIO_PIN_P3_6 = HAL_IOMUX_PIN_P3_6,
    HAL_GPIO_PIN_P3_7 = HAL_IOMUX_PIN_P3_7,

    HAL_GPIO_PIN_P4_0 = HAL_IOMUX_PIN_P4_0,
    HAL_GPIO_PIN_P4_1 = HAL_IOMUX_PIN_P4_1,
    HAL_GPIO_PIN_P4_2 = HAL_IOMUX_PIN_P4_2,
    HAL_GPIO_PIN_P4_3 = HAL_IOMUX_PIN_P4_3,
    HAL_GPIO_PIN_P4_4 = HAL_IOMUX_PIN_P4_4,
    HAL_GPIO_PIN_P4_5 = HAL_IOMUX_PIN_P4_5,
    HAL_GPIO_PIN_P4_6 = HAL_IOMUX_PIN_P4_6,
    HAL_GPIO_PIN_P4_7 = HAL_IOMUX_PIN_P4_7,

    HAL_GPIO_PIN_NUM = HAL_IOMUX_PIN_NUM,

    HAL_GPIO_PIN_LED1 = HAL_IOMUX_PIN_LED1,
    HAL_GPIO_PIN_LED2 = HAL_IOMUX_PIN_LED2,

    HAL_GPIO_PIN_LED_NUM = HAL_IOMUX_PIN_LED_NUM,
};

enum HAL_IOMUX_FUNCTION_T {
    HAL_IOMUX_FUNC_NONE = 0,
    HAL_IOMUX_FUNC_GPIO,
    HAL_IOMUX_FUNC_AS_GPIO = HAL_IOMUX_FUNC_GPIO,
    HAL_IOMUX_FUNC_AO_GPIO,
    HAL_IOMUX_FUNC_AO_PWM0,
    HAL_IOMUX_FUNC_AO_PWM1,
    HAL_IOMUX_FUNC_AO_PWM2,
    HAL_IOMUX_FUNC_AO_PWM3,
    HAL_IOMUX_FUNC_BT_BLE_MODE,
    HAL_IOMUX_FUNC_BT_CLK_OUT,
    HAL_IOMUX_FUNC_BT_RATE0,
    HAL_IOMUX_FUNC_BT_RATE1,
    HAL_IOMUX_FUNC_BT_RXFLAG,
    HAL_IOMUX_FUNC_BT_RXON,
    HAL_IOMUX_FUNC_BT_SPI_CLK,
    HAL_IOMUX_FUNC_BT_SPI_DI,
    HAL_IOMUX_FUNC_BT_SPI_DO,
    HAL_IOMUX_FUNC_BT_SPI_SENB,
    HAL_IOMUX_FUNC_BT_SWRX,
    HAL_IOMUX_FUNC_BT_SWTX,
    HAL_IOMUX_FUNC_BT_SYMRX0,
    HAL_IOMUX_FUNC_BT_SYMRX1,
    HAL_IOMUX_FUNC_BT_SYMRX2,
    HAL_IOMUX_FUNC_BT_SYMTX0,
    HAL_IOMUX_FUNC_BT_SYMTX1,
    HAL_IOMUX_FUNC_BT_SYMTX2,
    HAL_IOMUX_FUNC_BT_SYNC_P,
    HAL_IOMUX_FUNC_BT_TXEDR,
    HAL_IOMUX_FUNC_BT_TXFLAG,
    HAL_IOMUX_FUNC_BT_TXON,
    HAL_IOMUX_FUNC_BT_UART_CTS,
    HAL_IOMUX_FUNC_BT_UART_RTS,
    HAL_IOMUX_FUNC_BT_UART_RX,
    HAL_IOMUX_FUNC_BT_UART_TX,
    HAL_IOMUX_FUNC_CAM_D0,
    HAL_IOMUX_FUNC_CAM_D1,
    HAL_IOMUX_FUNC_CAM_D2,
    HAL_IOMUX_FUNC_CAM_D3,
    HAL_IOMUX_FUNC_CAM_D4,
    HAL_IOMUX_FUNC_CAM_D5,
    HAL_IOMUX_FUNC_CAM_D6,
    HAL_IOMUX_FUNC_CAM_D7,
    HAL_IOMUX_FUNC_CAM_HREF,
    HAL_IOMUX_FUNC_CAM_MCLK,
    HAL_IOMUX_FUNC_CAM_PCLK,
    HAL_IOMUX_FUNC_CAM_VSYNC,
    HAL_IOMUX_FUNC_CLK_12M,
    HAL_IOMUX_FUNC_CLK_32K_IN,
    HAL_IOMUX_FUNC_CLK_OUT,
    HAL_IOMUX_FUNC_CLK_REQ_IN,
    HAL_IOMUX_FUNC_CLK_REQ_OUT,
    HAL_IOMUX_FUNC_DSDIF_CK,
    HAL_IOMUX_FUNC_DSDIF_L,
    HAL_IOMUX_FUNC_DSDIF_R,
    HAL_IOMUX_FUNC_I2C_M_SCL,
    HAL_IOMUX_FUNC_I2C_M_SDA,
    HAL_IOMUX_FUNC_I2C_SCL,
    HAL_IOMUX_FUNC_I2C_SDA,
    HAL_IOMUX_FUNC_I2S0_SCK,
    HAL_IOMUX_FUNC_I2S0_SDI0,
    HAL_IOMUX_FUNC_I2S0_SDI1,
    HAL_IOMUX_FUNC_I2S0_SDI2,
    HAL_IOMUX_FUNC_I2S0_SDI3,
    HAL_IOMUX_FUNC_I2S0_SDO,
    HAL_IOMUX_FUNC_I2S0_WS,
    HAL_IOMUX_FUNC_MCU_CLK_OUT,
    HAL_IOMUX_FUNC_PCM_CLK,
    HAL_IOMUX_FUNC_PCM_DI,
    HAL_IOMUX_FUNC_PCM_DO,
    HAL_IOMUX_FUNC_PCM_FSYNC,
    HAL_IOMUX_FUNC_PDM0_CK,
    HAL_IOMUX_FUNC_PDM0_D,
    HAL_IOMUX_FUNC_PDM1_CK,
    HAL_IOMUX_FUNC_PDM1_D,
    HAL_IOMUX_FUNC_PDM2_CK,
    HAL_IOMUX_FUNC_PDM2_D,
    HAL_IOMUX_FUNC_PDM3_CK,
    HAL_IOMUX_FUNC_PDM3_D,
    HAL_IOMUX_FUNC_PWM0,
    HAL_IOMUX_FUNC_PWM1,
    HAL_IOMUX_FUNC_PWM2,
    HAL_IOMUX_FUNC_PWM3,
    HAL_IOMUX_FUNC_RST,
    HAL_IOMUX_FUNC_SDIO_CLK,
    HAL_IOMUX_FUNC_SDIO_CMD,
    HAL_IOMUX_FUNC_SDIO_DATA0,
    HAL_IOMUX_FUNC_SDIO_DATA1,
    HAL_IOMUX_FUNC_SDIO_DATA2,
    HAL_IOMUX_FUNC_SDIO_DATA3,
    HAL_IOMUX_FUNC_SDMMC_CLK,
    HAL_IOMUX_FUNC_SDMMC_CMD,
    HAL_IOMUX_FUNC_SDMMC_DATA0,
    HAL_IOMUX_FUNC_SDMMC_DATA1,
    HAL_IOMUX_FUNC_SDMMC_DATA2,
    HAL_IOMUX_FUNC_SDMMC_DATA3,
    HAL_IOMUX_FUNC_SDMMC_DATA4,
    HAL_IOMUX_FUNC_SDMMC_DATA5,
    HAL_IOMUX_FUNC_SDMMC_DATA6,
    HAL_IOMUX_FUNC_SDMMC_DATA7,
    HAL_IOMUX_FUNC_SMP0,
    HAL_IOMUX_FUNC_SMP1,
    HAL_IOMUX_FUNC_SMP2,
    HAL_IOMUX_FUNC_SMP3,
    HAL_IOMUX_FUNC_SMP4,
    HAL_IOMUX_FUNC_SMP5,
    HAL_IOMUX_FUNC_SMP6,
    HAL_IOMUX_FUNC_SMP7,
    HAL_IOMUX_FUNC_SMP8,
    HAL_IOMUX_FUNC_SMP9,
    HAL_IOMUX_FUNC_SMP10,
    HAL_IOMUX_FUNC_SMP11,
    HAL_IOMUX_FUNC_SMP12,
    HAL_IOMUX_FUNC_SMP13,
    HAL_IOMUX_FUNC_SMP14,
    HAL_IOMUX_FUNC_SMP15,
    HAL_IOMUX_FUNC_SPDIF0_DI,
    HAL_IOMUX_FUNC_SPDIF0_DO,
    HAL_IOMUX_FUNC_SPDIF1_DI,
    HAL_IOMUX_FUNC_SPDIF1_DO,
    HAL_IOMUX_FUNC_SPI_CLK,
    HAL_IOMUX_FUNC_SPI_CS,
    HAL_IOMUX_FUNC_SPI_DCN,
    HAL_IOMUX_FUNC_SPI_DIO,
    HAL_IOMUX_FUNC_SPILCD_CLK,
    HAL_IOMUX_FUNC_SPILCD_CS,
    HAL_IOMUX_FUNC_SPILCD_DCN,
    HAL_IOMUX_FUNC_SPILCD_DI,
    HAL_IOMUX_FUNC_SPILCD_DIO,
    HAL_IOMUX_FUNC_TCK,
    HAL_IOMUX_FUNC_TDI,
    HAL_IOMUX_FUNC_TDO,
    HAL_IOMUX_FUNC_TMS_SWDO,
    HAL_IOMUX_FUNC_UART0_CTS,
    HAL_IOMUX_FUNC_UART0_RX,
    HAL_IOMUX_FUNC_UART0_TX,
    HAL_IOMUX_FUNC_UART1_CTS,
    HAL_IOMUX_FUNC_UART1_RTS,
    HAL_IOMUX_FUNC_UART1_RX,
    HAL_IOMUX_FUNC_UART1_TX,
    HAL_IOMUX_FUNC_UART2_CTS,
    HAL_IOMUX_FUNC_UART2_RX,
    HAL_IOMUX_FUNC_UART2_TX,
    HAL_IOMUX_FUNC_USBTST_RX0,
    HAL_IOMUX_FUNC_USBTST_RX1,
    HAL_IOMUX_FUNC_USBTST_RX2,
    HAL_IOMUX_FUNC_USBTST_TX0,
    HAL_IOMUX_FUNC_USBTST_TX1,
    HAL_IOMUX_FUNC_WF_FEM_CNTL0,
    HAL_IOMUX_FUNC_WF_FEM_CNTL1,
    HAL_IOMUX_FUNC_WF_FEM_CNTL2,
    HAL_IOMUX_FUNC_WF_FEM_CNTL3,
    HAL_IOMUX_FUNC_WF_FEM_CNTL4,
    HAL_IOMUX_FUNC_WF_FEM_CNTL5,
    HAL_IOMUX_FUNC_WF_SDIO_CLK,
    HAL_IOMUX_FUNC_WF_SDIO_CMD,
    HAL_IOMUX_FUNC_WF_SDIO_DATA0,
    HAL_IOMUX_FUNC_WF_SDIO_DATA1,
    HAL_IOMUX_FUNC_WF_SDIO_DATA2,
    HAL_IOMUX_FUNC_WF_SDIO_DATA3,
    HAL_IOMUX_FUNC_WF_TXON,
    HAL_IOMUX_FUNC_WF_UART_CTS,
    HAL_IOMUX_FUNC_WF_UART_RTS,
    HAL_IOMUX_FUNC_WF_UART_RX,
    HAL_IOMUX_FUNC_WF_UART_TX,
    HAL_IOMUX_FUNC_WF_WAKE_HOST,
    HAL_IOMUX_FUNC_WF_WAKE1,
    HAL_IOMUX_FUNC_WF_WAKE2,
    HAL_IOMUX_FUNC_WIMAX_ACTIVE,

    HAL_IOMUX_FUNC_END
};

enum HAL_IOMUX_ISPI_ACCESS_T {
    HAL_IOMUX_ISPI_BT_RF            = (1 << 0),
    HAL_IOMUX_ISPI_BT_PMU           = (1 << 1),
    HAL_IOMUX_ISPI_BT_ANA           = (1 << 2),
    HAL_IOMUX_ISPI_MCU_RF           = (1 << 3),
    HAL_IOMUX_ISPI_MCU_PMU          = (1 << 4),
    HAL_IOMUX_ISPI_MCU_ANA          = (1 << 5),
    HAL_IOMUX_ISPI_WF_RF            = (1 << 6),
    HAL_IOMUX_ISPI_WF_PMU           = (1 << 7),
    HAL_IOMUX_ISPI_WF_ANA           = (1 << 8),
};

void hal_iomux_clear_spi(void);

void hal_iomux_clear_i2s(void);

void hal_iomux_set_mcu_clock_out(void);

void hal_iomux_set_bt_clock_out(void);

#ifdef __cplusplus
}
#endif

#endif
